﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using S7.Net;

namespace MyWPF.Models.S7
{
    public interface IS7
    {
        /// <summary>
        /// 打开与PLC的连接
        /// </summary>
        /// <returns></returns>
        bool Link(S7Context PlcConfig);

        /// <summary>
        /// 读取DB块里一个区域，返回byte数组
        /// </summary>
        /// <param name="DataType"></param>
        /// <param name="DB"></param>
        /// <param name="StartAdr"></param>
        /// <param name="Length"></param>
        /// <returns></returns>
        byte[] ReadBytes(int DB, int StartAdr, int Length);

    }

    public class S7Context
    {
        /// <summary>
        /// PLC类型
        /// </summary>
        public CpuType CpuType { get; set; }
        /// <summary>
        /// PLC的IP地址
        /// </summary>
        public string IP { get; set; }
    }
}
